﻿<cfsilent>
	<cfscript>
		
		currentTab = event.getArg("TabID","labWorkType");
	
		event.setArg("pageTitle", "师资工作量 - 编制当量设置");
	
		sql = "SELECT 
					a.hrt, a.type_name, 
					a.type_desc, a.type_period
				FROM t_hr_workload a  
				ORDER BY 
					a.hrt";
					
		queryObj = new query( datasource=application.dnsSlave  );
		
		rs_type = queryObj.execute( sql=sql ).getResult();
	
		passArgs = structNew();
	
		typeId = event.getArg("Type");
		rs_hrLord = queryNew("hrt");
	
		if( len(typeId) ) {

			sql = "SELECT 
					a.hrt, a.type_name, 
					a.type_desc, a.type_period
				FROM t_hr_workload a  
				WHERE a.hrt = :typeId ";
					
			queryObj = new query( datasource=application.dnsSlave  );
			queryObj.addParam( name="typeId", value=typeId, cfsqltype="cf_sql_char" );
			
			rs_hrLord = queryObj.execute( sql=sql ).getResult();
			
			currentTab = "labWorkTypeEdit";

		}
	
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat"> <a class="uiButton" href="<cfoutput>#buildURL('DEFAULT_EVENT')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">师资教学工作量</span></a> </div>
			<div>
				<h2 class="uiHeaderTitle"> <i class="uiHeaderImage img icon16x16 card"></i>编制分类</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
					<span <cfif currentTab eq "labWorkType">class="active"</cfif> id="labWorkType" tabTarget="WorkType">编制分类设置</span>
					<cfif rs_hrLord.recordCount GT 0>
						<span <cfif currentTab eq "labWorkTypeEdit">class="active"</cfif> id="labWorkTypeEdit" tabTarget="WorkTypeEdit">编辑</span>
						<span <cfif currentTab eq "labWorkTypeRemove">class="active"</cfif> id="labWorkTypeRemove" tabTarget="WorkTypeRemove">删除</span>
					</cfif>
					<cfif currentTab eq "labCreate">
						<span <cfif currentTab eq "labCreate">class="active"</cfif> id="labCreate" tabTarget="Create">新建编制分类</span>
					</cfif>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>				
				</script>
				
				<div id="WorkType" class="tabContent">
					
					<div class="noticeBlock">
						<div class="operation">
							<a class="uiButton " href="<cfoutput>#buildURL('WorkLoadType', {TabID='labCreate'} )#</cfoutput>"><i class="mrs img btnAdd"></i><span class="uiButtonText">添加类型</span></a>
						</div>
						<h3>编制分类</h3>
						<p><span class="img icon16x16 message"></span>编制分类，用于人员编制的计算。</p>
						<hr/>
					</div>
					
					<cfif rs_type.recordCount>

						<table class="UIEditable">
							<thead>
								<tr>
									<td width="30"></td>
									<td width="130">编制分类名称</td>
									<td width="60">当量学时</td>
									<td>描述</td>
									<td width="16"></td>
								</tr>
							</thead>
							<tbody>
                                <cfloop query="rs_type" >
									
									<cfset structInsert( passArgs, "Type", rs_type.hrt, true ) />
									
									<tr class="editRows">
										<td><span class="index"><cfoutput>#rs_type.hrt#</cfoutput></span></td>
										<td><cfoutput>#rs_type.type_name#</cfoutput></td>
										<td><span class="numeric"><cfoutput>#rs_type.type_period#</cfoutput></span></td>
										<td><cfoutput>#rs_type.type_desc#</cfoutput></td>
										<td><a href="<cfoutput>#buildURL('WorkLoadType', passArgs)#</cfoutput>" class="stat edit"></a></td>
									</tr>
									
								</cfloop>
								<cfset structDelete( passArgs, "Type" ) />
							</tbody>
						</table>
						
					<cfelse>

						<div class="systemNotice">
							<p>尚未设置编制分类</p>
						</div>
						
					</cfif>
				</div>
				
				<cfif rs_hrLord.recordCount GT 0>
					
					<div id="WorkTypeEdit" class="tabContent">
					
						<div class="noticeBlock">
							<h3>修改编制分类</h3>
							<p><span class="img icon16x16 message"></span>根据课程实际情况, 设置编制分类对应的学时当量，用于人员编制的计算</p>
							<hr/>
						</div>
						
						<form id="formEdit" onsubmit="javascript:return processVerfiyForm('formEdit');" class="formWrapper" method="post" action="<cfoutput>#BuildURL('saveHRWorkLoadDo')#</cfoutput>">
							
							<input type="hidden" name="HRType" value="<cfoutput>#rs_hrLord.hrt#</cfoutput>"/>
							
							<div class="label">
								<b>名称</b>
								<input type="text" name="TypeName" class="typeTextShort" value="<cfoutput>#rs_hrLord.type_name#</cfoutput>" verification="required" />
							</div>
							
							<div class="label">
								<b>当量学时</b>
								<input type="text" name="Period" class="typeSmallInt" value="<cfoutput>#rs_hrLord.type_period#</cfoutput>" verification="integer" />
								<p class="notice">工作当量学时用于计算课程学时对应的教师编制测算数据</p>
							</div>
							
							<div class="label"> <span class="req">*</span><b>描述</b>
								<textarea name="TypeNotice" verification="required"><cfoutput>#rs_hrLord.type_desc#</cfoutput></textarea>
							</div>
							
							<hr/>
							
							<div class="lable">
								<input class="button5" type="submit" value="保存" />
							</div>
							
						</form>
					</div>
					
					<div id="WorkTypeRemove" class="tabContent">
						
						<div class="systemNotice">
							<h3><span class="img icon16x16 info"></span>警告：删除分类</h3>
							<p>警告: 删除一个分类会删除所有与该分类相关联的数据，请删除之前确认明确操作所带来的影响. </p>
						</div>

						<form id="formRemove" class="formWrapper Transparent" method="post" action="<cfoutput>#BuildURL('removeHRWorkLoadDo')#</cfoutput>">
							
							<input type="hidden" name="HRType" value="<cfoutput>#rs_hrLord.hrt#</cfoutput>">							
							
							<div id="FirstDelete" class="lable"><input class="button2" type="button" value="已经充分了解"></div>
							<div id="SecondDelete" class="lable hidden_elem"><input class="button2" type="submit" value="确认删除"></div>
							
							<script type="text/javascript">
								//<![CDATA[
								<!--
								$(document).ready(function(e) {
									
									$("#FirstDelete").click(function(){
										$("#FirstDelete").addClass("hidden_elem");
										$("#SecondDelete").removeClass("hidden_elem");
									});
									
								});
								// -->
								//]]>
							</script>
							
						</form>
						
					</div>
					
				</cfif>
				
				<cfif currentTab eq "labCreate">
				
					<div id="Create" class="tabContent">
				
						<div class="noticeBlock">
							<h3>新建编制分类</h3>
							<p><span class="img icon16x16 message"></span>新建编制分类,可用于人员编制的计算。</p>
							<hr/>
						</div>
				
						<form id="formCreate" onsubmit="javascript:return processVerfiyForm('formCreate');" class="formWrapper" method="post" action="<cfoutput>#BuildURL('createHRWorkLoadDo')#</cfoutput>">
				
							<div class="label">
								<b>名称</b>
								<input type="text" name="TypeName" class="typeTextShort" value="" verification="required" />
							</div>
				
							<div class="label">
								<b>当量学时</b>
								<input type="text" name="Period" name="Period" class="typeSmallInt" value="" verification="integer" />
								<p class="notice">工作当量学时用于计算课程学时对应的教师编制测算数据</p>
							</div>
				
							<div class="label">
								<b>描述</b>
								<textarea name="TypeNotice" class="" verification="required"></textarea>
							</div>
				
							<hr/>
				
							<div class="lable">
								<input class="button5" type="submit" value="新建">
							</div>
							
						</form>
						
					</div>
					
				</cfif>
				
			</div>
		</li>
	</ul>
</div>
